package com.qfedu.task;

import com.qfedu.biz.OrderBiz;

import java.util.Timer;
import java.util.TimerTask;
//设置订单定时任务实现TimerTask接口
public class OrderTask extends TimerTask {
    private OrderBiz orderBiz;
    private String oid;
    //将定时器传进定时任务中，在定时任务完成之后关闭定时器
    private Timer timer;

    public OrderTask(OrderBiz orderBiz, String oid, Timer timer) {
        this.orderBiz = orderBiz;
        this.oid = oid;
        this.timer = timer;
    }

    public OrderTask() {
    }

    @Override
    public void run() {
        Boolean aBoolean = orderBiz.updataStatus(oid,3);
            //取消定时任务
            timer.cancel();

    }
}
